﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;


namespace PPad
{
    public partial class Doc : Form
    {
        public int newDocWidth;
        public int newDocHeight;
        public string newDocBackgroundColor;
        public string newDocForeColor;
       
        public Doc()
        {
            InitializeComponent();
        }

        private void Doc_Load(object sender, EventArgs e)
        {
            // style 1 is for background
            textEditor.Styles[1].BackColor = Color.Red;

            // style 2, font
            textEditor.Styles[2].ForeColor = Color.White;
            textEditor.Styles[2].Font = new Font("Times New Roman", 16, FontStyle.Bold);

            // add some text
            textEditor.Text = "";

            // style 1 
            textEditor.ConfigurationManager.Language = "js";
            textEditor.BackColor = ColorTranslator.FromHtml(this.newDocBackgroundColor);
            textEditor.IsBraceMatching = true;
            
            
        }

        // Convert a string to an object

        object FromString(object obj, Type type)
        {
            TypeConverter converter = TypeDescriptor.GetConverter(type);
            return converter.ConvertFromString(obj.ToString());
        }


        private void textEditor_KeyUp(object sender, KeyEventArgs e)
        {
            // MessageBox.Show(sender.ToString());
            StatusStrip st;
            st = (StatusStrip)MdiParent.Controls["statusBar"];
            if (Control.IsKeyLocked(Keys.CapsLock))
            {
                
                st.Items["toolStripStatusLabel1"].Text = "CAPS";

            }
            else
            {
                    st.Items["toolStripStatusLabel1"].Text = "";
                //Parent.Controls["toolStripStatusLabel1"].Text = "CAPS";
            }

            int row = textEditor.Caret.LineNumber + 1;
            int col = textEditor.GetColumn(textEditor.Caret.Position) + 1;

            
            st.Items["rowCounter"].Text = "Row: " + row.ToString();
            st.Items["colCounter"].Text = "Col: " + col.ToString();
        }

 

        private void zoomFactor_Click(object sender, EventArgs e)
        {

        }

        private void zoomFactor_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void zoomFactor_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void textEditor_TextChanged(object sender, EventArgs e)
        {

        }

        private void textEditor_ZoomChanged(object sender, EventArgs e)
        {
            
        }

        private void textEditor_KeyDown(object sender, KeyEventArgs e)
        {
            
            

            
        }




   
    }
}
